from selenium import webdriver
from selenium.webdriver.common.by import By

options=webdriver.ChromeOptions()
options.add_experimental_option('detach', True)
service = webdriver.ChromeService(executable_path='./chromedriver-win64/chromedriver.exe')
browser=webdriver.Chrome(options=options, service=service)

browser.get('https://www.baidu.com')
browser.maximize_window()

button = browser.find_element(by=By.ID, value='su')
#获取元素属性
print(button.get_attribute('class'))

#获取标签的名字

print(button.tag_name)

#获取元素文本

a = browser.find_element(by=By.LINK_TEXT, value='新闻')
print(a.text)

